/* eslint-disable */
/**
 * Created by GYL on 2018/7/25
 * 权限涉及 文件上传 删除 结构变化 
 */
import React, { Component } from 'react';
import { Alert, Tabs, Form, Row, Tooltip, Input, Select, DatePicker, Popconfirm, TreeSelect, Col, message, Upload, Button, Icon } from 'antd';
import config from '../../../../config';
import Util from '../../../../utils/Util';
import PublicService from "../../../../services/PublicService";
import request from '../../../../utils/request';
import MyTable from "../../../../components/common/MyTable";
import moment from 'moment';
import styles from '../../EventPosting.less';
const IconFont = Icon.createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/font_1315525_quw7a5i25p.js',
});
const { TextArea } = Input;
const FormItem = Form.Item;
const { SHOW_CHILD } = TreeSelect;
class Small_Tab1 extends Component {
    componentDidMount() {


        request({
            url: '/pm-web/projectmanage/subeventsInfo/getSubeventsInfoType',
            method: 'POST',
            data: { subeventsId: this.props.id, userId: PublicService.getCookie('userId') }
        }).then(data => {
            // console.log(data)
            if (data.rc === 0) {
                this.setState({
                    flag: data.ret.type
                })
            }
        })


        //获取文件结构
        this.getFileSiteTreeTwo()
        let params = {}
        this.props.onModalSave(this)
        request({
            url: '/pm-web/projectmanage/progress/projectSubeventsInfo',
            method: 'POST',
            data: { subeventsId: this.props.id, userId: PublicService.getCookie('userId') }
        }).then(data => {
            // console.log(data)
            if (data.rc == 0) {
                this.setState({
                    auditWay: data.ret.auditWay,
                    pid: data.ret.subeventsId,
                    dataSource: data.ret.fileList,
                    sureWay: data.ret.sureWay
                })
            }

            if (data.rc === 0) {

                let List = [
                    {
                        type: 'TextArea',
                        paramName: 'subeventsWeight',
                        id: 'subeventsWeight',
                        key: "subeventsWeight",
                        label: '子级事件权重',
                        stylesCol: { display: data.ret.hierarchy == 1 ? '' : 'none' },
                        style: { width: 170 },
                        span: 12,
                        rows: 1,
                        rules: data.ret.hierarchy == 1 ? [{ ...config.reg.long3 }] : null,
                        title: '0/4',
                        // num: 4,
                        colSpan: 24,
                        disabled: true,
                        initialValue: data.ret.subeventsWeight,
                    },
                    {
                        type: 'select',
                        paramName: 'milepost',
                        id: 'milepost',
                        key: "milepost",
                        label: '是否为里程碑',
                        style: { width: 177 },
                        rules: [{ ...config.reg.required }],
                        span: 12,
                        placeholder: '请选择',
                        stylesCol: { display: data.ret.hierarchy == 1 ? '' : 'none' },
                        options: [

                            { text: '否', value: 0 },
                            { text: '是', value: 1 },

                        ],
                        initialValue: data.ret.milepost,
                        disabled: true
                    },
                    {
                        type: 'TextArea',
                        paramName: 'subeventsDescribe',
                        id: 'subeventsDescribe',
                        key: "subeventsDescribe",
                        label: '子级事件说明',
                        style: { width: 647 },
                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.subeventsDescribe,
                        disabled: true

                    },
                    {
                        type: 'TextArea',
                        paramName: 'outcomeDocument',
                        id: 'outcomeDocument',
                        key: "outcomeDocument",
                        label: '成果文件',
                        style: { width: 647 },
                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.outcomeDocument,
                        disabled: true
                    },
                    {
                        type: 'TextArea',
                        paramName: 'confirmUserName',
                        id: 'confirmUserName',
                        title: '最多显示30个字',
                        key: "confirmUserName",
                        label: '子级确认用户',
                        style: { width: 647 },

                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.confirmUserName,
                        disabled: true

                    },
                    {
                        type: 'TextArea',
                        paramName: 'responsibleDepartmentName',
                        id: 'responsibleDepartmentName',
                        title: '最多显示30个字',
                        num: 30,
                        key: "responsibleDepartmentName",
                        label: '子级责任部门',
                        style: { width: 647 },

                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.responsibleDepartmentName,
                        disabled: true

                    },
                    {
                        type: 'TextArea',
                        paramName: 'assDepRoles',
                        id: 'assDepRoles',
                        title: '最多显示30个字',
                        num: 30,
                        key: "assDepRoles",
                        label: '子级协助部门',
                        style: { width: 647 },

                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.assDepRoles,
                        disabled: true

                    },
                    {
                        type: 'TextArea',
                        paramName: 'safetyInformation',
                        id: 'safetyInformation',
                        title: '最多显示200个字',
                        key: "safetyInformation",
                        label: '安全防护措施',
                        style: { width: 647 },
                        disabled: true,
                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.safetyInformation,

                    },
                    {
                        type: 'TextArea',
                        paramName: 'safetyInformationUserStr',
                        id: 'safetyInformationUserStr',
                        title: '最多显示200个字',
                        key: "safetyInformationUserStr",
                        label: '安全提示人员',
                        style: { width: 647 },
                        disabled: true,
                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.safetyInformationUserStr,

                    },


                    {
                        type: 'datePicker',
                        label: '计划开始时间',
                        paramName: 'planStartTime',
                        initialValue: data.ret.planStartTime ? moment(data.ret.planStartTime) : '',
                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        disabled: true,
                    },
                    {
                        type: 'datePicker',
                        label: '计划结束时间',
                        paramName: 'planEndTime',
                        initialValue: data.ret.planEndTime ? moment(data.ret.planEndTime) : '',
                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        disabled: true,
                    },
                    {
                        type: 'datePicker',
                        label: '实际开始时间',
                        paramName: 'actualStartTime',
                        initialValue: data.ret.actualStartTime ? moment(data.ret.actualStartTime) : '',
                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        disabled: true,
                    },
                    {
                        type: 'datePicker',
                        label: '实际结束时间',
                        paramName: 'actualEndTime',
                        initialValue: data.ret.actualEndTime ? moment(data.ret.actualEndTime) : '',
                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        disabled: true,
                    },

                    {
                        type: 'select',
                        paramName: 'sureWay',
                        id: 'sureWay',
                        key: "sureWay",
                        label: '子级确认方式',

                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        placeholder: '请选择',
                        disabled: true,

                        initialValue: data.ret.sureWay,
                        options: [
                            { text: '用户勾选', value: 1 },
                            { text: '上传文档', value: 2 },


                        ]
                    },
                    {
                        type: 'select',
                        paramName: 'auditWay ',
                        id: 'auditWay ',
                        key: "auditWay ",
                        label: '审核方式',
                        style: { width: 170 },
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        placeholder: '请选择',
                        disabled: true,

                        initialValue: data.ret.auditWay,
                        options: [
                            { text: '不需审核', value: 1 },
                            { text: '系统内审核', value: 2 },
                            { text: '系统内抄送', value: 3 },
                            { text: 'OA审批', value: 4 },
                        ]
                    },
                    {
                        type: 'TextArea',
                        paramName: 'workTime',
                        id: 'workTime',
                        title: '只能填写数字',
                        num: 30,
                        key: "workTime",
                        label: '计划工期',
                        style: { width: 170, height: 20 },
                        disabled: true,
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        initialValue: data.ret.workTime,

                    },
                    {
                        type: 'TextArea',
                        paramName: 'practicalWorkTime',
                        id: 'practicalWorkTime',
                        title: '只能填写数字',
                        num: 30,
                        key: "practicalWorkTime",
                        label: '实际工期(天)',
                        style: { width: 170, height: 20 },
                        // rules: [{ ...config.reg.long }],
                        span: 8,
                        rows: 1,
                        colSpan: 24,
                        initialValue: data.ret.practicalWorkTime,
                        // disabled: !this.props.flag
                        disabled: true
                    },
                    {
                        type: 'TextArea',
                        paramName: 'remark',
                        id: 'remark',
                        // title: '最多显示30个字',
                        title: `${data.ret.remark ? data.ret.remark.length : '0'}/30`,
                        num: 30,
                        key: "remark",
                        label: '子级事件备注',
                        style: { width: 647 },
                        // 
                        span: 24,
                        rows: 2,
                        colSpan: 24,
                        initialValue: data.ret.remark,
                        disabled: !this.props.flag

                    },



                ]

                //确认方式为上传文档
                if (data.ret.auditWay == 2) {
                    List.push(
                        {
                            type: 'TextArea',
                            paramName: 'auditUserStr',
                            id: 'auditUserStr',
                            title: '最多显示30个字',
                            num: 30,
                            key: "auditUserStr",
                            label: '审核用户',
                            style: { width: 647 },
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.auditUserStr,
                            disabled: true

                        },
                        {
                            type: 'TextArea',
                            paramName: 'auditCcUserStr',
                            id: 'auditCcUserStr',
                            title: '最多显示30个字',
                            num: 30,
                            key: "auditCcUserStr",
                            label: '抄送用户',
                            style: { width: 647 },
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.auditCcUserStr,
                            disabled: true

                        },
                    )
                    //系统内审核

                } else if (data.ret.auditWay == 3) {
                    //系统内抄送
                    List.push(
                        {
                            type: 'TextArea',
                            paramName: 'auditCcUserStr',
                            id: 'auditCcUserStr',
                            title: '最多显示30个字',
                            num: 30,
                            key: "auditCcUserStr",
                            label: '子级抄送用户',
                            style: { width: 647 },
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.auditCcUserStr,
                            disabled: true

                        },
                    )
                } else if (data.ret.auditWay == 4) {
                    List.push(
                        {
                            type: 'TextArea',
                            paramName: 'oaUserName',
                            id: 'oaUserName',
                            title: '最多显示200个字',
                            key: "oaUserName",
                            label: 'OA人员',
                            style: { width: 647 },
                            disabled: true,
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.oaUserName,

                        }
                    )

                }



                if (data.ret.startDelay) {
                    //当前时间 大于计划结束时间 逾期理由必填

                    List.push(

                        {
                            type: 'TextArea',
                            paramName: 'startDelay',
                            id: 'startDelay',
                            title: '最多显示30个字',
                            num: 30,
                            key: "startDelay",
                            label: '逾期开始理由',
                            style: { width: 647 },
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.startDelay,
                            disabled: true

                        },
                    )

                    this.setState({
                        arr: List
                    })
                }

                if (data.ret.endDelay) {
                    List.push(

                        {
                            type: 'TextArea',
                            paramName: 'endDelay',
                            id: 'endDelay',
                            title: '最多显示30个字',
                            num: 30,
                            key: "endDelay",
                            label: '逾期结束理由',
                            style: { width: 647 },
                            span: 24,
                            rows: 2,
                            colSpan: 24,
                            initialValue: data.ret.endDelay,
                            disabled: true

                        },

                    )
                    this.setState({
                        arr: List
                    })
                } else {
                    //当前时间 大于计划结束时间 逾期理由必填
                    if (moment() > moment(data.ret.planEndTime + ' 23:59:59')) {
                        List.push(

                            {
                                type: 'TextArea',
                                paramName: 'endDelay',
                                id: 'endDelay',
                                title: '最多显示30个字',
                                num: 30,
                                key: "endDelay",
                                label: '逾期结束理由',
                                style: { width: 647 },
                                rules: this.props.flag && [{ ...config.reg.required }],
                                span: 24,
                                rows: 2,
                                colSpan: 24,
                                initialValue: data.ret.endDelay,
                                disabled: !this.props.flag

                            },

                        )
                        this.setState({
                            arr: List
                        })
                    }

                }

                this.setState({
                    arr: List
                })

            }
        })
    }

    getFileSiteTreeTwo = () => {
        request({
            url: '/pm-web/projectmanage/filesite/getFileSiteTreeTwo',
            method: 'POST',
            data: { subeventsId: this.props.id}
        }).then(data => {
            if (data.rc === 0) {
                this.setState({
                    TreeSelecttreeData: data.ret.tmList
                })
            }
        })
    }

    myName = () => {
        alert(11111111111111)

    }

    state = {
        arr: [],
        // treeData1: [],
        pid: '',
        dataSource: [],
        TreeSelecttreeData: [],//文件结构
        flag: true
    }
    //计算文本域内数字个数
    onChangeNum = (v) => {
        var strs = getByteLen(v);
        function getByteLen(val) {
            strs = val.replace(/[\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\||\\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\，|\。|\？|\：|\；|\‘|\’|\”|\“|\、|\·|\！|\（|\）|\》|\《|\『|\』]/g, "");
            return strs;
        }
        return strs.length

    }
    // 筛选条件组件change事件
    getChangeValue = (value, e) => {
        let t = this;
        let params = {};
        params[value] = e.target.value;
        t.setState({ params });
        //form表单赋值-----改变文本域数字个数
        this.props.form.setFieldsValue({ [value]: e.target.value })
        this.addChange(value, e.target.value.length)



    }



    getChangeValueList = (value, e) => {
        let t = this;
        let params = {};
        params[value] = e.target.value;
        t.setState({ params });
        //form表单赋值-----改变文本域数字个数
        this.props.form.setFieldsValue({ [value]: e.target.value })
        this.addChangeList(value, e.target.value.length)


    }

    addChangeList = (v, num) => {
        this.state.arr[10].list.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}字`
            }
        });
    }

    addChangeSon = (v, num, index) => {
        this.state.sonArr[index].sonArrList.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}字`
            }
        });
    }
    //新增改变tooplie的显示文字
    addChange = (v, num) => {
        this.state.arr.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}字`
            }
        });
    }

    //保存按钮事件
    childFunction = () => {

        this.props.form.validateFields((errors, values) => {
            if (!errors) {
                // console.log(values)
                let params = {
                    remark: values.remark,
                    endDelay: values.endDelay,
                    auditWay: this.state.auditWay,
                    subeventsId: this.props.id
                }
                request({
                    url: '/pm-web/projectmanage/progress/accomplishSubeventsInfo',
                    method: 'POST',
                    data: params
                }).then(data => {
                    if (data.rc === 0) {
                        message.success('保存成功')
                        this.props.onSmall_Tab1()
                    } else {
                        message.warning('保存失败')
                    }
                })
            }


        });

    }


    selectedChange(fun, nextParams, paramName, index, value) {
        // console.log(fun, nextParams, paramName, index, value)


        let t = this;
        let params = {};
        params[paramName] = value;
        if (paramName) {
            t.setState({ params }, () => {
            });
        }
        if (typeof fun === "function") {
            fun(value);
            if (nextParams)
                t.props.form.setFieldsValue({
                    [nextParams]: ''
                })
        }
    }


    //多选
    onSelectChange = (selectedRowKeys, row) => {
        // console.log(selectedRowKeys, row)
        this.setState({ selectedRowKeys, row })
    };


    //上传
    onsc = (info) => {
        if (info.file.status !== 'uploading') {
        }
        if (info.file.status === 'done') {
            message.success(`${info.file.name} 上传成功`);
            this.onsaveSc()
            this.getFileList()


        } else if (info.file.status === 'error') {
            message.error(`${info.file.name} 上传失败.`);
        }
    }

    //查询上传附件
    onsaveSc = () => {
        request({
            url: `/pm-web/projectmanage/knowledgebase/getFileList`,
            method: 'POST',
            data: { parentId: this.state.pid, tableName: 'ta_re_event_sub' }
        }).then(data => {
            // console.log(data)
            if (data.rc == 0) {

                this.setState({
                    dataSource: data.ret.fileList
                })
            }
        })
    }
    //bianji查询上传附件
    getFileList = () => {
        request({
            url: `/pm-web/projectmanage/knowledgebase/getFileList`,
            method: 'POST',
            data: { parentId: this.state.pid, tableName: 'ta_re_event_sub' }
        }).then(data => {
            // console.log(data)
            if (data.rc == 0) {

                this.setState({
                    dataSource: data.ret.fileList
                })
            }
        })
    }

    //删除上传文件
    onDelete = (record) => {
        // console.log(record)
        if (!this.props.flag) {
            return
        }
        request({
            url: `/pm-web/projectmanage/fileupload/deleteFile?id=${record.id}`,
            method: 'GET',
        }).then(data => {
            if (data.rc == 0) {
                message.success('删除成功');
                this.onsaveSc()
            }
        })
    }


    TreeSelectselectedChange = (record, index, value) => {
        // console.log(record, index, value)


        request({
            url: `/pm-web/projectmanage/fileupload/fileBindingCatalog`,
            method: 'POST',
            data: { catalogId: value, fileId: record.id }
        }).then(data => {
            if (data.rc === 0) {
                this.state.dataSource[index].fileSiteId = value
                setTimeout(() => {
                    this.setState({
                        dataSource: this.state.dataSource
                    })
                }, 500)
            } else {
                message.warning(`${data.err}`)
            }

        })
    }


    confirm = (record) => {

        this.onDelete(record)
    }

    cancel = (e) => {

    }

    onDatePicker = (paramName, v, str) => {
        console.log(paramName, v, str)
        setTimeout(() => {
            // console.log(this.props.form.getFieldValue('planStartTime'))

            if (this.props.form.getFieldValue('planEndTime') && this.props.form.getFieldValue('planStartTime')) {
                let num = this.props.form.getFieldValue('planEndTime').diff(this.props.form.getFieldValue('planStartTime'), 'days')
                console.log(num)
                if (this.props.form.getFieldValue('planStartTime').isBefore(this.props.form.getFieldValue('planEndTime'))) {

                } else {
                    message.warning('结束时间不可以小于开始时间!')
                    this.props.form.setFieldsValue({ 'planEndTime': null })
                    return
                }
                if (num > 0) {
                    num = num + 1
                }
                if (num == 0) {
                    num = 1
                }
                if (num < 0) {
                    message.warning('结束时间不可以小于开始时间!')
                    return
                } else {
                    this.props.form.setFieldsValue({ 'workTime': num })
                }
            }

        }, 500);


    }


    render() {
        let { getFieldDecorator } = this.props.form;
        let t = this;
        const columns = [

            {
                title: '文件名',
                dataIndex: 'fileName',
                width: '20%',
                align: "center",
            },
            {
                title: "文件所属结构",
                dataIndex: 'fileType',
                width: '25%',
                align: "center",
                render: (text, record, index) => {
                    return <TreeSelect
                        className={styles.TreeSelect}
                        disabled={!this.state.flag}
                        showSearch
                        // treeCheckable={true}
                        // disabled={!this.props.flag}
                        // className={item.shuoming}
                        maxTagCount={5}
                        // style={item.style}
                        treeData={this.state.TreeSelecttreeData}
                        onChange={this.TreeSelectselectedChange.bind(this, record, index)}
                        value={record.fileSiteId}
                        showCheckedStrategy={SHOW_CHILD}
                        searchPlaceholder={'请选择文件位置'}
                    // disabled={item.disabled}
                    />

                }
            },

            {
                title: '上传时间',
                width: '20%',
                dataIndex: 'createTime',
                align: "center",
                render: (text, record) => {
                    return <span>
                        {record.createTime ? moment(record.createTime).format('YYYY-MM-DD HH:mm:ss') : '无'}
                    </span>

                }
            },
            {
                title: '上传人',
                width: '15%',
                dataIndex: 'uploadUser',
                align: "center",
            },
            {
                title: '操作',
                width: '10%',
                dataIndex: 'uploadUs123er',
                align: "center",
                render: (text, record) => {
                    return <span >
                        <Popconfirm
                            title="确定删除此条数据?"
                            onConfirm={this.confirm.bind(this, record)}
                            onCancel={this.cancel}
                            okText="是"
                            cancelText="否"
                        >
                            <a href="javascript:;" style={{ display: this.props.flag ? '' : 'none' }}>删除</a>
                        </Popconfirm>
                    </span>

                }
            },
        ]
        const props1 = {
            name: 'file',
            action: '/pm-web/projectmanage/fileupload/dopost',

            headers: {
                authorization: 'authorization-text',
            },
            data: {
                pid: this.state.pid,
                tableName: "ta_re_event_sub",
                uploadUser: PublicService.getCookie('nickName'),
            },
            multiple: true,
            showUploadList: true

        };
        return (
            <div style={{ height: "45vh", overflow: 'auto', paddingBottom: '100px' }} className={styles.Small1}>
                <Form layout={'inline'} style={{ paddingLeft: 40, paddingRight: 40 }} >
                    <Row gutter={48} key={55555}>
                        {
                            this.state.arr.map((item, index) => {
                                if (item.type === 'TextArea') {
                                    return (
                                        // <Col span={item.span} key={index}>
                                        <Col span={item.span || 8} key={index} className={item.className} style={item.stylesCol}>
                                            <Form.Item label={item.label} key={item.paramName} >
                                                <Tooltip
                                                    trigger={['focus']}
                                                    title={item.title}
                                                    placement="topLeft"
                                                    overlayClassName="numeric-input"
                                                >
                                                    {
                                                        getFieldDecorator(item.paramName, {
                                                            initialValue: item.initialValue ? item.initialValue : '',
                                                            rules: item.rules || null
                                                        })(

                                                            <TextArea
                                                                className={item.shuoming}
                                                                style={item.style}
                                                                placeholder={item.placeholder}
                                                                onChange={this.onChange}
                                                                rows={item.rows}
                                                                maxLength={item.num}
                                                                disabled={item.disabled} id={[item.paramName]}
                                                                size={config.size} style={item.style}
                                                                onChange={this.getChangeValue.bind(this, item.paramName)}
                                                            />

                                                        )
                                                    }
                                                </Tooltip>
                                            </Form.Item>
                                        </Col>
                                    )
                                } else if (item.type === 'input') {
                                    return (
                                        <Col span={item.span || 8} key={index} className={item.className}>
                                            <Form.Item label={item.label} key={item.paramName}>
                                                {
                                                    getFieldDecorator(item.paramName, {
                                                        initialValue: item.initialValue ? item.initialValue : '',
                                                        rules: item.rules || null
                                                    })(
                                                        <input
                                                            style={item.style}
                                                            type='number'
                                                            disabled={item.disabled} id={[item.paramName]}
                                                            size={config.size} style={item.style} onChange={this.getChangeValue.bind(this, item.paramName)}
                                                        />
                                                    )
                                                }
                                            </Form.Item>
                                        </Col>
                                    )
                                } else if (item.type === 'select') {
                                    return (
                                        <Col span={item.span || 8} key={index} className={item.className} style={item.stylesCol}>
                                            <Form.Item label={item.label} key={item.paramName} >
                                                {
                                                    getFieldDecorator(item.paramName, {
                                                        initialValue: item.initialValue ? item.initialValue : (item.options[0] ? Util.numToString(item.options[0].value) : item.options[0]),
                                                        rules: item.rules || null
                                                    })(
                                                        <Select
                                                            size={config.size}
                                                            showSearch
                                                            mode={item.mode}
                                                            placeholder="Select a person"
                                                            style={{ width: item.width || 170 }}
                                                            optionFilterProp="children"
                                                            dropdownMatchSelectWidth={t.props.dropdownMatchSelectWidth}


                                                            disabled={item.disabled}
                                                        >
                                                            {
                                                                item.options.map(option => {
                                                                    return (
                                                                        <Select.Option key={option.value}
                                                                            value={Util.numToString(option.value)}
                                                                        >
                                                                            {option.text}
                                                                        </Select.Option>

                                                                    )
                                                                })
                                                            }
                                                        </Select>
                                                    )
                                                }
                                            </Form.Item>
                                        </Col>
                                    )
                                } else if (item.type === 'datePicker') {
                                    let disabled = item.disabledDate ? disabledDate : null;
                                    return (
                                        <Col span={item.span || 8} key={index} className={item.className}>
                                            <Form.Item label={item.label} key={item.paramName} >
                                                {
                                                    getFieldDecorator(item.paramName, {
                                                        initialValue: item.initialValue ? item.initialValue : null,
                                                        rules: item.rules || null
                                                    })(
                                                        <DatePicker size={config.size} disabledDate={disabled} disabled={item.disabled} onChange={this.onDatePicker.bind(this, item.paramName)} />
                                                    )
                                                }
                                            </Form.Item>
                                        </Col>
                                    )
                                } else if (item.type === 'treeSelect') {
                                    return (
                                        <Col span={item.span || 8} key={index} className={item.className}>
                                            <Form.Item label={item.label} key={item.paramName} >
                                                {
                                                    getFieldDecorator(item.paramName, {
                                                        initialValue: item.initialValue ? item.initialValue : null,
                                                        rules: item.rules || null
                                                    })(
                                                        <TreeSelect
                                                            showSearch
                                                            disabled={item.disabled}
                                                            treeData={item.treeData}
                                                            style={item.style}
                                                            treeCheckable={item.treeCheckable}
                                                            showCheckedStrategy={SHOW_CHILD}
                                                            searchPlaceholder={'请选部门'}
                                                        />
                                                    )
                                                }
                                            </Form.Item>
                                        </Col>
                                    )
                                } else if (item.type === 'title') {
                                    return (
                                        <Row key={item.name}>
                                            <h2 style={{ fontSize: 14, fontWeight: 700 }}><span style={{ borderTopLeftRadius: 3, borderTopRightRadius: 3, padding: 1, color: "#fff", backgroundColor: "#03a9f4" }}> {item.name}</span></h2>

                                            {/* <div style={{ width: "100%", borderBottom: "1px solid #ccc",marginBottom:10 }}></div> */}
                                        </Row>


                                    )
                                } else if (item.type === 'arr') {
                                    return (
                                        item.list.map((item, index) => {
                                            if (item.type === 'TextArea') {
                                                return (
                                                    <Col span={item.span || 8} key={index} className={item.className}>
                                                        <Form.Item label={item.label} key={item.paramName}>
                                                            <Tooltip
                                                                trigger={['focus', 'hover']}
                                                                title={item.title}
                                                                placement="topLeft"
                                                                overlayClassName="numeric-input"
                                                            >
                                                                {
                                                                    getFieldDecorator(item.paramName, {
                                                                        initialValue: item.initialValue ? item.initialValue : '',
                                                                        rules: item.rules || null
                                                                    })(

                                                                        <TextArea
                                                                            style={item.style}
                                                                            placeholder={item.placeholder}
                                                                            // onChange={this.onChange}
                                                                            rows={item.rows}
                                                                            maxLength={item.num || null}
                                                                            disabled={item.disabled} id={[item.paramName]}

                                                                        />

                                                                    )
                                                                }
                                                            </Tooltip>
                                                        </Form.Item>
                                                    </Col>
                                                )
                                            }

                                        })


                                    )
                                } else if (item.type === 'button') {
                                    return (
                                        <button onClick={this.addListfx}>新增</button>
                                    )
                                }

                            })
                        }

                    </Row>
                </Form>
                <div style={{ width: '100%', height: 'auto', padding: '0px 40px', display: this.state.sureWay == 2 ? '' : 'none' }}>
                    {/* <p style={{ margin: 5 }}>仅支持预览doc、docx、pdf、jpg、png、xls、xlsx,最大限制为20MB</p> */}
                    <Alert showIcon closable message="仅支持预览doc、docx、pdf、jpg、png、xls、xlsx,最大限制为20MB" type="warning" />
                    <p style={{ margin: 5, display: this.state.flag ? '' : 'none' }} id='flag'>

                        <Upload {...props1} onChange={this.onsc}>
                            <div style={{
                                margin: 5,
                                marginLeft: 0,
                                marginRight: 0,
                                cursor: 'pointer'
                            }}>
                                <IconFont type="icon-wenjianshangchuan" style={{ fontSize: 25 }} />
                                上传文件

                            </div>
                        </Upload>
                    </p>
                    <MyTable
                        pagination={false}
                        columns={columns}
                        dataSource={this.state.dataSource}
                    />
                </div>

            </div>
        )
    }
}

export default Form.create()(Small_Tab1);
